package cn.imvc.app.filter;

import java.util.Collection;

import com.alibaba.fastjson.serializer.PropertyFilter;
import com.alibaba.fastjson.support.config.FastJsonConfig;

public class JSONFilterConfig extends FastJsonConfig {
	public final static PropertyFilter WITHOOUT_COLLENTION_PROPERTY_FILTER = new PropertyFilter() {
		@Override
		public boolean apply(Object object, String name, Object value) {
			if (value == null || value instanceof Collection) {
				return !object.getClass().getName().startsWith("cn.imvc.app.entities");
			}
			return true;
		}
	};
	public JSONFilterConfig() {
		super();
		this.setSerializeFilters(WITHOOUT_COLLENTION_PROPERTY_FILTER);
	}

}
